package cannot.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cannot.mapper.TypeTvMapper;
import cannot.pojo.TypeTv;
import cannot.pojo.TypeTvExample;
import cannot.service.TypeTvService;

@Service
public class TypeTvServiceImpl implements TypeTvService {
	@Autowired
	TypeTvMapper typeTvMapper;
	public int insert(TypeTv record) {
		return typeTvMapper.insert(record);
	}
	@Override
	public void deleteByTvId(Integer id) {
		TypeTvExample example = new TypeTvExample();
		example.createCriteria().andTv_idEqualTo(id);
		List<TypeTv>  typeTvs = typeTvMapper.selectByExample(example);
		for(TypeTv typeTv:typeTvs){
			typeTvMapper.deleteByPrimaryKey(typeTv.getId());
		}
	}

}
